#! /bin/bash
problem=$1
loop=$2
i=1;
cd bin
cp moea.$problem.properties moea.properties
cd ..

printf "\n"
while [ $i -le $loop ]
do
   printf "%s  %d/%d paralel\r" $problem $i $loop
   make --silent run.home >> out.$problem.parallel.txt

   printf "%s  %d/%d serial \r" $problem $i $loop
   make --silent run.standalone >> out.$problem.serial.txt
   i=$((i+1))
done
printf "plotting... \n"
cd metrics/
./metrics_zdt.m plot $problem ../results/$problem/parallel/*.data > /dev/null
./metrics_zdt.m plot $problem ../results/$problem/serial/*.data > /dev/null
printf "[done]\n"

printf "metrics... \n"
./metrics_zdt.m stat $problem ../results/$problem/parallel/*.data > ../results/$problem/parallel/summary
./metrics_zdt.m stat $problem ../results/$problem/serial/*.data > ../results/$problem/serial/summary
cd ..

printf "[done]"
